var PRIMARY_PATH = "";
var BASE_PATH = "";

function setPath(path,basePath){
	PRIMARY_PATH = path;
	BASE_PATH = basePath;
}

$(function() {
	// 给select2组件加载样式
	WASP_WIDGET.initializeSelectStyle();
	$(".use-select2").select2();
	// 注册清空事件
    WASP_WIDGET.registerResetClearEvent();
    
    initValidateForm();
});


function initValidateForm() {
	$("#tradeUnitAddForm").validate({
		focusCleanup : true,
		rules : {
			'tradeType' : {
				required : true
			},
			'tradeCode' : {
				required : true
			},
			'tradeName' : {
				required : true
			},
			'partnerCodeCard' : {
				required : true
			},
			'managementPeople' : {
				required : true
			}
		},
		messages : {
			'tradeType' : {
				required : "交易单元类型不能为空"
			},
			'tradeCode' : {
				required : "交易单元代码不能为空"
			},
			'tradeName' : {
				required : "交易单元名称不能为空"
			},
			'partnerCodeCard' : {
				required : "股东代码卡不能为空"
			},
			'managementPeople' : {
				required : "管理人不能为空"
			}
		}
	});
}

function doSubmit(){
	var form = $('#tradeUnitAddForm');
	if(false === form.valid()){
		toastr.warning("请完善信息");
		return;
	}
	//提交表单
	SubmitAndPreventSecond("tradeUnitAddForm",true);
}